//
//  NSObject+SLSafe.h
//  SLKit
//
//  Created by S_LINE on 2020/9/29.
//  Copyright © 2020 S_LINE. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface NSObject (SLSafe)

// NSString安全方法
- (NSString *)trimForString:(NSString *)trimString;
- (BOOL)sl_isEqualToString:(NSString *)string;
- (BOOL)sl_containsString:(NSString *)string;
- (BOOL)sl_hasPrefix:(NSString *)string;
- (BOOL)sl_hasSuffix:(NSString *)string;
// NSArray安全方法
- (nullable id)sl_objectAtIndex:(NSUInteger)index;
- (BOOL)sl_containsObject:(id _Nullable)obj;
- (void)sl_addObject:(id)object;
- (void)sl_insertObject:(id)object atIndex:(NSUInteger)index;
- (void)sl_removeLastObject;
- (void)sl_removeObjectAtIndex:(NSUInteger)index;
- (void)sl_removeObject:(id)obj;
- (void)sl_replaceObjectAtIndex:(NSUInteger)index withObject:(id)object;
// NSDictionarya安全方法
- (nullable id)sl_objectForKey:(id<NSCopying>)key;
- (nullable NSString *)sl_stringForKey:(id<NSCopying>)key;
- (nullable NSDecimalNumber *)sl_decimalNumberForKey:(id<NSCopying>)key;
- (void)sl_removeObjectForKey:(id<NSCopying>)key;
- (void)sl_setObject:(id)object forKey:(id<NSCopying>)key;
- (BOOL)sl_containsKey:(id<NSCopying>)key;

@end

NS_ASSUME_NONNULL_END
